#include "pch.h"
#include "Application.h"
#include "MainWindow.h"




int main( int argc, char *argv[] )
{
	Application theApp(argc, argv);

	try
	{
		QSqlDatabase database = QSqlDatabase::addDatabase("QSQLITE", "no_default_connection");
		database.setDatabaseName("../Gui/Crawler.db");
		if(!database.open())
			BOOSTEXT_THROW(boostext::exception("Unable to connect to database"));
		db::Connection::Ptr connection(new db::Connection(database, db::RDBMS::create(db::RDBMS::SQLITE)));

		Bot::Ptr  bot(new Bot(theApp.provider(), connection));
		bot->add(QUrl("http://www.google.de/"));

		MainWindow window(theApp.provider(), bot);
		window.show();

		return theApp.exec();
	}
	catch(boostext::exception& e)
	{
		Application::onException(e);
	}
	catch(std::exception& e)
	{
		Application::onException(e);
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
